const cloud = require('wx-server-sdk')

cloud.init({
	env: cloud.DYNAMIC_CURRENT_ENV,
})

exports.main = async () => {
	try {
		const { OPENID } = cloud.getWXContext()

		const getUserInfo = await cloud.database().collection('gn_user').doc(OPENID).get()

		return {
			code: 0,
			msg: '创建成功',
			data: getUserInfo.data,
		}
	} catch (err) {
		throw err
	}
}
